﻿-if(ViewData.ContainsKey("SavedStates"))
  -var rf_ss = ViewData["SavedStates"] as List<SavedState>
  -var rf_myss = rf_ss.Where(s=>!s.Public)
  -var rf_pubss = rf_ss.Where(s=>s.Public)
  -string ss_selid = Convert.ToString(ViewData["StateId"])
  -if(ViewData.ContainsKey("SaveStateException"))
    .error=ViewData["SaveStateException"]
  -if( rf_myss.Count() > 0)
    %ul.filterlist
      -foreach(var ss in rf_myss)
        %li{class=(ss_selid==ss.Id.ToString())?"state selected":"state",id=string.Format("savedfilter{0}", ss.Id)}
          %a{href=string.Format("{0}.ivp/{1}?stateid={2}",ViewData["Controller"],ViewData["ActionKey"],ss.Id)}=ss.Name
          %span.hover
            %a{href="#",onclick=string.Format("return deleteState({0});",ss.Id)} <img src="img/trash.gif" title="Удалить фильтр"/>
    .spacer5
  -else
    .indent10.details Нет сохраненных фильтров
    .spacer5
  -if( rf_pubss.Count() > 0)
    %h3 Общие фильтры
    %ul.filterlist
      -foreach(var ss in rf_pubss)
        %li{class=(ss_selid==ss.Id.ToString())?"state selected":"state",id=string.Format("savedfilter{0}", ss.Id)}
          %a{href=string.Format("{0}.ivp/{1}?stateid={2}",ViewData["Controller"],ViewData["ActionKey"],ss.Id)}=ss.Name
          -if((ViewData["user"] as IUser).HasPermission("dictionaryadmin"))
            %span.hover
              %a{href="#",onclick=string.Format("return deleteState({0});",ss.Id)} <img src="img/trash.gif" title="Удалить фильтр"/>
    .spacer5
